package com.framework.spring.mybatis.bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.stereotype.Component;

/**
 * @Title:
 * @Description: 功能概述:
 * @Author: lihaiyang
 * @version: 1.0 .
 * @Date: 2023-12-06 17:35
 * 
 */
@Component
@Slf4j(topic = "e")
public class EBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		log.info("EBeanFactoryPostProcessor#postProcessBeanFactory");
		AbstractBeanDefinition e = (AbstractBeanDefinition) beanFactory.getBeanDefinition("e");
		e.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);

		AbstractBeanDefinition f = (AbstractBeanDefinition) beanFactory.getBeanDefinition("f");
		f.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
//		// 忽略实现了IAware接口中的方法
//		beanFactory.ignoreDependencyInterface(IAware.class);

//		// 自动注入使用set 忽略K类型 @Autowired属于手动注入 使用的构造方法
//		beanFactory.ignoreDependencyType(K.class);

	}
}
